﻿/*
======================================================================================
CreatedTime:2011-10-28
Description:三层架构业务逻辑层父类
======================================================================================
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Collections;
using System.Data.SqlClient;
using DAL;
using Models;
namespace BLL
{
	/// <summary>
	/// 业务逻辑类Tb_Category 的摘要说明。
	/// </summary>
	public class Tb_CategoryManagerBase
    {
	    protected readonly DAL.Tb_CategoryServiceBase dal = new DAL.Tb_CategoryServiceBase();
		
		#region 构造方法
		/// <summary>
		/// 业务逻辑类Tb_Category 的构造方法。
		/// </summary>
        /// <returns></returns>
		public Tb_CategoryManagerBase()
        { }
		#endregion
		
		#region  成员方法
		#region 是否存在该记录
        /// <summary>
        /// Tb_Category表是否存在该记录
        /// </summary>
        /// <param name="cid"></param>
        /// <returns>bool</returns>
        public bool ExistsTb_Category(int cid)
        {
            return dal.ExistsTb_Category(cid);
        }
		#endregion
		#region 增加一条数据
		/// <summary>
		/// Tb_Category表增加一条数据
		/// </summary>
		/// <param name="tb_Category">对象</param>
        /// <returns>row</returns>	
		public int AddTb_Category(Tb_Category tb_Category)
		{
			return dal.AddTb_Category(tb_Category);
		}
		#endregion
		#region 更新一条数据
		/// <summary>
		/// Tb_Category表更新一条数据
		/// </summary>
		/// <param name="tb_Category">对象</param>
        /// <returns>row</returns>
		public int ModifyTb_Category(Tb_Category tb_Category)
		{
			return dal.ModifyTb_Category(tb_Category);
		}
		#endregion
	    #region 删除一条数据
		/// <summary>
		/// 根据Tb_Category表主键ID删除一条数据
		/// </summary>
		/// <param name="cid"></param>
        /// <returns>row</returns>
		public int DeleteTb_CategoryByCid(int cid)
		{
			return dal.DeleteTb_CategoryByCid(cid);
		}
		#endregion
		#region 得到一个对象实体
		/// <summary>
		/// Tb_Category表通过cid得到一个对象实体
		/// </summary>
		/// <param name="cid"></param>
        /// <returns>Tb_Category</returns>
		public Tb_Category GetTb_CategoryByCid(int cid)
		{
			return dal.GetTb_CategoryByCid(cid);
		}
		#endregion
		#region 得到一个对象实体,返回List泛型集合
		/// <summary>
		/// Tb_Category表得到一个泛型实体对象
		/// </summary>
        /// <returns>IList</returns>
		public IList<Tb_Category> GetAllListFromTb_Categorys()
		{
			return dal.GetAllTb_Categorys();
		}
		#endregion
		#region 得到一个对象实体,返回List泛型集合
		/// <summary>
		/// Tb_Category通过cid得到实体对象,返回List泛型集合
		/// </summary>
        /// <returns>IList</returns>
		public IList<Tb_Category> GetListFromTb_CategoryByCid(int cid)
		{
		string sql =@"Select * From Tb_Category 
                    Where cid=@cid";
			try
			{
				SqlParameter[] para = new SqlParameter[]
				{
                 new SqlParameter("@cid",cid)
				};
				return dal.GetTb_CategorysBySql(sql,para);
			}
			catch (Exception e)
			{
				throw e;
			}
		}					
		#endregion
		#region
		/// <summary>
		/// Tb_Category表通过sql语句的条件（“where”已经写上）得到一个实体对象（泛型集合）
		/// </summary>
		/// <param name="strWhere">strWhere</param>
        /// <returns>IList</returns>
		public IList<Tb_Category> GetTb_CategorysByStrWhere(string strWhere)
		{
		    return dal.GetTb_CategorysByStrWhere(strWhere);
		}
		#endregion
		#region 获得数据列表
		/// <summary>
        /// Tb_Category表根据条件字符串strWhere获得数据列表
        /// </summary>
		/// <param name="StrWhere">条件字符串</param>
        /// <returns>DataSet</returns>
        public DataSet GetDataSetFromTb_Category(string strWhere)
        {
            return dal.GetDataSetFromTb_Category(strWhere);
        }
		#endregion
		#region 获得全部数据列表
		/// <summary>
        /// Tb_Category获得数据列表
        /// </summary>
        /// <returns>DataSet</returns>
        public DataSet GetDataSetFromTb_Category()
        {
            return dal.GetDataSetFromTb_Category("");
        }
		#endregion
		#region 接收条件和参数Hashtable，返回DataTable
		/// <summary>
		/// Tb_Category表接收条件和参数Hashtable，返回DataTable
		/// </summary>
		/// <param name="StrWhere"></param>
		/// <param name="table"></param>
        /// <returns>DataTable</returns>
		public DataTable GetDataTableFromTb_Category(string strWhere,Hashtable table)
		{
			return dal.GetDataTableFromTb_Category(strWhere,table);
		}
		#endregion
		#region 接收条件和参数Hashtable，返回List泛型集合
		/// <summary>
		/// Tb_Category表接收条件和参数Hashtable，返回List泛型集合
		/// </summary>
		/// <param name="StrWhere"></param>
		/// <param name="table"></param>
        /// <returns>IList</returns>
		public IList<Tb_Category> GetListFromTb_Category(string strWhere,Hashtable table)
		{
			return dal.GetListFromTb_Category(strWhere,table);
		}
		#endregion
		#region 接收条件和参数Hashtable，返回一个实体类对象
		/// <summary>
		/// Tb_Category表接收条件和参数Hashtable，返回一个实体类对象
		/// </summary>
		/// <param name="StrWhere"></param>
		/// <param name="table"></param>
        /// <returns>Tb_Category对象</returns>
		public Tb_Category GetModelTb_CategoryByWhere(string strWhere, Hashtable table)
		{
			return dal.GetModelFromTb_CategoryByWhere(strWhere, table);
		}
		#endregion
		#region 接收条件，返回一个实体类对象
		/// <summary>
		/// Tb_Category表接收条件，返回一个实体类对象
		/// </summary>
		/// <param name="StrWhere"></param>
		/// <param name="table"></param>
        /// <returns>Tb_Category对象</returns>
		public Tb_Category GetModelTb_CategoryByWhere(string strWhere)
		{
			return dal.GetModelFromTb_CategoryByWhere(strWhere);
		}
		#endregion
		#region 接收条件和参数Hashtable，删除符合条件的记录
		/// <summary>
		/// Tb_Category表接收条件和参数Hashtable，删除符合条件的记录
		/// </summary>
		/// <param name="StrWhere"></param>
		/// <param name="table"></param>
        /// <returns>row</returns>
		public int DeleteTb_CategoryByWhere(string strWhere, Hashtable table)
		{
			return dal.DeleteTb_CategoryByWhere(strWhere, table);
		}
			/// <summary>
		/// Tb_Category表接收条件和参数，删除符合条件的记录
		/// </summary>
		/// <param name="StrWhere"></param>
		/// <param name="table"></param>
        /// <returns>row</returns>
		public int DeleteTb_CategoryByWhere(string strWhere)
		{
			return dal.DeleteTb_CategoryByWhere(strWhere);
		}
		#endregion
		#endregion
	}
}
